<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Z-7
  Date: 2022/3/3
  Time: 20:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${pageContext.request.contextPath}/resource/bootstrap4/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/resource/js/jquery-3.2.1.js"></script>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/resource/bootstrap-treeview/js/bootstrap-treeview.js"></script>
    <script src="${pageContext.request.contextPath}/resource/bootstrap4/js/bootstrap.js"></script>
    <title>订单详情</title>
</head>
<body>
<jsp:include page="../head.jsp"/>
<div class="container">
    <span>
        订单编号：${order.id}
    </span>
    <span>

    </span>
    <table class="table table-hover">
        <thead>
        <tr>
            <th scope="col">编号</th>
            <th scope="col">商品名称</th>
            <th scope="col">数量</th>
            <th scope="col">金额</th>
            <th scope="col">下单时间</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${order.orderItems}" var="item" varStatus="count">
            <tr>
                <th scope="row">${count.count}</th>
                <td>${item.goodsName}</td>
                <td>${item.buyNum}</td>
                <td>${item.price * item.buyNum}</td>
                <td>
                    <fmt:formatDate value="${order.createTime}" pattern="yyyy-MM-dd"/>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td colspan="100" align="right">
                共计${order.price}元，应付${order.factPrice}元
                <form action="${pageContext.request.contextPath}/order/pay" method="post">
                    <input type="hidden" name="id" value="${order.id}">
                    <button type="submit" class="btn btn-primary btn-lg">付款</button>
                </form>
            </td>
        </tr>
        </tbody>
    </table>
</div>
</body>
</html>
